'use strict';
const request = require('request');
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	const data = await getMod(event)
	console.log(data);
	//返回数据给客户端
	return event
};

const getMod = (data) => {
	return new Promise((res, rej) => {
		console.log(data);
		request({
				url: "https://db.steamworkshopdownloader.io/prod/api/details/file",
				json: true,
				body: JSON.stringify(data),
				method: "POST",
				headers: {
					'Content-Type': 'text/plain',
				}
			},
			function(error, response, body) {
				console.log("`````````````````````````````````");
				console.log(error);
				console.log(response);
				res(body)
			})
			console.log(2111111111111);
	})
}